package jpa.entitys.promis.common;

import java.io.Serializable;
import javax.persistence.*;

/**
 * The primary key class for the INVOICE_DETAILS database table.
 * 
 */
@Embeddable
public class InvoiceDetailPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;

	@Column(unique=true, nullable=false, length=2)
	private String company;

	@Column(name="INVOICE_TYPE", unique=true, nullable=false, length=2)
	private String invoiceType;

	@Column(name="INVOICE_SERIES", unique=true, nullable=false, length=4)
	private String invoiceSeries;

	@Column(name="INVOICE_NO", unique=true, nullable=false, precision=6)
	private long invoiceNo;

	@Column(name="INVOICE_SEQ_NO", unique=true, nullable=false, precision=6)
	private long invoiceSeqNo;

    public InvoiceDetailPK() {
    }
	public String getCompany() {
		return this.company;
	}
	public void setCompany(String company) {
		this.company = company;
	}
	public String getInvoiceType() {
		return this.invoiceType;
	}
	public void setInvoiceType(String invoiceType) {
		this.invoiceType = invoiceType;
	}
	public String getInvoiceSeries() {
		return this.invoiceSeries;
	}
	public void setInvoiceSeries(String invoiceSeries) {
		this.invoiceSeries = invoiceSeries;
	}
	public long getInvoiceNo() {
		return this.invoiceNo;
	}
	public void setInvoiceNo(long invoiceNo) {
		this.invoiceNo = invoiceNo;
	}
	public long getInvoiceSeqNo() {
		return this.invoiceSeqNo;
	}
	public void setInvoiceSeqNo(long invoiceSeqNo) {
		this.invoiceSeqNo = invoiceSeqNo;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof InvoiceDetailPK)) {
			return false;
		}
		InvoiceDetailPK castOther = (InvoiceDetailPK)other;
		return 
			this.company.equals(castOther.company)
			&& this.invoiceType.equals(castOther.invoiceType)
			&& this.invoiceSeries.equals(castOther.invoiceSeries)
			&& (this.invoiceNo == castOther.invoiceNo)
			&& (this.invoiceSeqNo == castOther.invoiceSeqNo);

    }
    
	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + this.company.hashCode();
		hash = hash * prime + this.invoiceType.hashCode();
		hash = hash * prime + this.invoiceSeries.hashCode();
		hash = hash * prime + ((int) (this.invoiceNo ^ (this.invoiceNo >>> 32)));
		hash = hash * prime + ((int) (this.invoiceSeqNo ^ (this.invoiceSeqNo >>> 32)));
		
		return hash;
    }
}